<script lang="ts">
import { defineComponent } from "vue";
import HomeList from "./components/homeList.vue";
import HomeTabs from "@/components/common/homeTabs.vue";
import { IRoomListParams } from "@/api/interface";

export default defineComponent({
  setup() {},
  components: {
    HomeList,
    HomeTabs
  },
  // 服务端的预取
  asyncData({ store, route }: any) {
    // 需要return才会生效 实际返回的是一个Promise
    return store.dispatch("getRoomList", {
      pageNo: store.state.pageNo
    } as IRoomListParams);
  }
});
</script>

<template>
  <div class="home-page">
    <!-- banner -->
    <div class="banner"></div>
    <!-- 房屋列表 -->
    <div class="main-wrapper">
      <!-- 城市筛选 -->
      <HomeTabs></HomeTabs>
      <h2 class="title">主标题</h2>
      <p class="sub-title">副标题</p>
      <!-- 首页列表 -->
      <HomeList></HomeList>
    </div>
  </div>
</template>

<style scoped lang="scss">
@import "@/assets/scss/home/index.scss";
</style>
